import fs from 'node:fs'
import { createRequire } from 'node:module'

const require = createRequire(import.meta.url)


export const g_pkg = require('../package.json')

export const targets = fs.readdirSync(g_pkg.targetsDir).filter(f => {
  if(!fs.statSync(`${g_pkg.targetsDir}/${f}`).isDirectory()) {
    return false
  }
  const cpkg = require(`../${g_pkg.targetsDir}/${f}/package.json`)
  if(cpkg.private && !cpkg.buildOptions) {
    return false
  }
  return true
})